package com.example.springmvcwork.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
@Controller
@RequestMapping(value = "/calc")
public class CalcController {
    @ResponseBody
    @GetMapping(value = "/sum1")
    public String sum1(int a, int b, Model model){
        a=a+b;
        return "a+b = "+a;
    }

    @GetMapping(value = "/sum12/{a}/{b}")
    @ResponseBody
    public String sum12(@PathVariable int a, @PathVariable int b, Model model)
    {
        a=a+b;
        return "a+b = "+a;
    }

    @RequestMapping("/post")
    public String post(){
        return "post";
    }


    @PostMapping("/PostSum")
    @ResponseBody
    public String PostMapping(int a,int b,Model model){

        a=a+b;
        return "a+b = "+a;
    }
}
